#ifndef GNRENDERER_H
#define GNRENDERER_H
#include "GnSmartPointer.h"
#include "GnObject.h"

class GNMAIN_ENTRY GnRenderer : public GnObject
{
protected:
	enum eRendererType
	{
		RENDERERDIRECTX9,
		RENDERERDIRECTX11,
		RENDERER_NULL,
	};

public:
	
	struct GNMAIN_ENTRY CreationParameters
	{
		typedef GnRenderer* (CreateGnRenderer)(GnRenderer::CreationParameters*);		
		CreationParameters(eRendererType rendererType, guint width, guint height,
			guint useflag, GnWindowHandle deviceHandle, GnWindowHandle focusHandle);
		guint mWidth;
		guint mHeight;
		guint mUseFlags;
		eRendererType mRendererType;
		GnWindowHandle mFocusHandle;
		GnWindowHandle mDeviceHandle;
		CreateGnRenderer* mCreate;
	};	


protected:
	GnRenderer(void);

public:
	virtual	~GnRenderer(void);
	static GnRenderer* Create(CreationParameters* createParam);
	inline static GnRenderer* GetRenderer();
	virtual void BeginFrame();
	virtual void EndFrame();
	virtual void DisplayFrame();

protected:
	virtual bool Init(CreationParameters* createParam) = 0;

	virtual bool RealBeginFrame() = 0;
	virtual bool RealEndFrame() = 0;
	virtual bool RealDisplayFrame() = 0;

protected:
	static GnRenderer* mspRenderer;
};

GnSmartPtr(GnRenderer);

#include "GnRenderer.inl"
#endif // GNRENDERER_H
